package jk;


import javax.swing.*;
import java.awt.*;

public class Test2 extends JFrame implements Runnable {

    int x=100;
    int y=100;
    Thread thread;

    public Test2(){
        setSize(800,800);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        thread = new Thread(this);
        thread.start();
    }

    public void paint(Graphics g){
        super.paint(g);
        g.setColor(Color.red);
        g.fillArc(x, y, 100, 100, 90, 360);
    }

    public static void main(String[] args){
        Test2 test2 = new Test2();
    }


    @Override
    public void run() {
        while(true){
            x=x+2;
            y=y+2;
            try {
                Thread.sleep(50);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            repaint();
        }
    }
}

